using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class TextLinkMap : EntityTypeConfiguration<TextLink>
    {
        public TextLinkMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.country)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.linktext)
                .HasMaxLength(60);

            this.Property(t => t.linkurl)
                .HasMaxLength(100);

            this.Property(t => t.linktitle)
                .HasMaxLength(250);

            this.Property(t => t.description)
                .HasMaxLength(250);

            // Table & Column Mappings
            this.ToTable("TextLinks");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.country).HasColumnName("country");
            this.Property(t => t.linktext).HasColumnName("linktext");
            this.Property(t => t.linkurl).HasColumnName("linkurl");
            this.Property(t => t.linktitle).HasColumnName("linktitle");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
        }
    }
}
